package orange.com.openstack.tools;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author osvaldo.cocucci@gmail.com
 *
 */
public class DateConverter {

	/**
	 * @param format
	 * @param dateInString
	 * @return the date object according to date input string and the specified format e.g : yyyy-MM-dd'T'HH:mm:ss.SSSSSS
	 */
	public static Date String2Date(String format, String dateInString) {
		SimpleDateFormat formatter = new SimpleDateFormat(format);
		Date date = null;
		try {

			date = formatter.parse(dateInString);

		} catch (ParseException e) {
			e.printStackTrace();
		}
		return date;
	}
}
